package com.appkubes.mall.restful.application.customer.customer.controller;

import com.appkubes.cloud.config.params.paramValid.ParamValid;
import com.appkubes.common.Response;
import com.appkubes.mall.core.entity.MallCustomer;
import com.appkubes.mall.restful.application.customer.customer.entity.dto.CustomerInfoDTO;
import com.appkubes.mall.restful.application.customer.customer.entity.vo.AdminKeyVO;
import com.appkubes.mall.restful.application.customer.customer.entity.vo.ModifyCustomerVO;
import com.appkubes.mall.restful.application.customer.customer.service.CustomerService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author: Lin Jiaming
 * @Date: 2020-03-02
 */
@Slf4j
@RestController
@RequestMapping("/customer")
@Api(tags = "   商户模块(供应商)")
public class CustomerController {

    @Autowired
    CustomerService customerService;

    @PostMapping("/userInfo")
    @ApiOperation("获取用户信息")
    public Response userInfo(@ParamValid AdminKeyVO param) {
        CustomerInfoDTO userInfo = customerService.getCustomerInfo(param.getAdminKey());
        return Response.success(userInfo);
    }

    @PostMapping("/modifyUserInfo")
    @ApiOperation("修改用户信息")
    public Response modifyUserInfo(@ParamValid ModifyCustomerVO param) {
        MallCustomer customer = new MallCustomer();
        customerService.updateById(customer);
        return Response.success();
    }

}
